﻿Imports System.IO
Public Class MapEditorAddMobile
    Inherits System.Windows.Forms.Form
    Implements IMessageFilter
    Private WM_KEYDOWN As Integer = &H100
    Private WM_KEYUP As Integer = &H101
    Public MobData As String
    Public DefaultMobile As Integer
    Public MobData_HasQuest As Boolean
    Public MobData_LEVEL As String
    Public MobData_VIRID As String
    Public MobData_SHORT As String
    Public MobData_MNAME As String
    Public MobData_LDESC As String
    Public MobData_SCRIT As String
    Public MobData_RACET As String
    Public MobData_ARCHE As String
    Public MobData_TEMPE As String
    Public MobData_CLASS As String
    Public MobData_HITPO As String
    Public MobData_WILLP As String
    Public MobData_STAMP As String
    Public MobData_Sentient As String
    Public MobData_HATE_sex As String
    Public MobData_HATE_race As String
    Public MobData_HATE_class As String
    Public MobData_LOVE_sex As String
    Public MobData_LOVE_race As String
    Public MobData_LOVE_class As String
    Public MobData_PATH_brekfast As String
    Public MobData_PATH_lunch As String
    Public MobData_PATH_dinner As String
    Public MobData_PATH_work As String
    Public MobData_PATH_sleep As String
    Public MobData_MobType As String
    Public MobData_MobClass As String
    Public MobData_MobClassCombatPreset As String
    Public MobData_DROP_static1 As String
    Public MobData_DROP_static2 As String
    Public MobData_DROP_static3 As String
    Public MobData_DROP_static4 As String
    Public MobData_DROP_static5 As String
    Public MobData_DROP_dynamic1 As String
    Public MobData_DROP_dynamic2 As String
    Public MobData_DROP_dynamic3 As String
    Public MobData_DROP_dynamic4 As String
    Public MobData_DROP_dynamic5 As String
    Public MobData_DMG1_name As String
    Public MobData_DMG1_dienum As String
    Public MobData_DMG1_dietype As String
    Public MobData_DMG1_type As String
    Public MobData_DMG1_speed As String
    Public MobData_DMG1_crit As String
    Public MobData_DMG2_name As String
    Public MobData_DMG2_dienum As String
    Public MobData_DMG2_dietype As String
    Public MobData_DMG2_type As String
    Public MobData_DMG2_speed As String
    Public MobData_DMG2_crit As String
    Public MobData_DMG3_name As String
    Public MobData_DMG3_dienum As String
    Public MobData_DMG3_dietype As String
    Public MobData_DMG3_type As String
    Public MobData_DMG3_speed As String
    Public MobData_DMG3_crit As String
    Public MobData_DMG4_name As String
    Public MobData_DMG4_dienum As String
    Public MobData_DMG4_dietype As String
    Public MobData_DMG4_type As String
    Public MobData_DMG4_speed As String
    Public MobData_DMG4_crit As String
    Public MobData_DMG5_name As String
    Public MobData_DMG5_dienum As String
    Public MobData_DMG5_dietype As String
    Public MobData_DMG5_type As String
    Public MobData_DMG5_speed As String
    Public MobData_DMG5_crit As String
    Public MobData_AC_bash As String
    Public MobData_AC_slash As String
    Public MobData_AC_pierce As String
    Public MobData_AC_fist As String
    Public MobData_AC_exotic As String
    Public MobData_STR_bash As String
    Public MobData_STR_slash As String
    Public MobData_STR_pierce As String
    Public MobData_STR_fist As String
    Public MobData_STR_exotic As String
    Public MobData_RES_fire As String
    Public MobData_RES_subfire As String
    Public MobData_RES_water As String
    Public MobData_RES_subwater As String
    Public MobData_RES_air As String
    Public MobData_RES_subair As String
    Public MobData_RES_earth As String
    Public MobData_RES_subearth As String
    Public MobData_RES_spirit As String
    Public MobData_RES_subspirit As String
    Public MobData_AMP_fire As String
    Public MobData_AMP_subfire As String
    Public MobData_AMP_water As String
    Public MobData_AMP_subwater As String
    Public MobData_AMP_air As String
    Public MobData_AMP_subair As String
    Public MobData_AMP_earth As String
    Public MobData_AMP_subearth As String
    Public MobData_AMP_spirit As String
    Public MobData_AMP_subspirit As String
    Public MobData_MOUNT_bag As String
    Public MobData_MOUNT_speed As String
    Public MobData_MOUNT_lvlreq As String
    Public MobData_MOUNT_soverncost As String
    Public MobData_MOUNT_dovercost As String
    Public MobData_MOUNT_verncost As String
    Public ScriptData As String
    Public ScriptData_INTRO As String
    Public ScriptData_Option(5) As String
    Public ScriptData_OPTIONS As String
    Public ScriptData_OPTION1 As String
    Public ScriptData_OPTION2 As String
    Public ScriptData_OPTION3 As String
    Public ScriptData_OPTION4 As String
    Public ScriptData_OPTION5 As String
    Public ScriptData_REFRESH As String
    Public EmoteData As String
    Public EmoteData_EMOTE As String
    Public EmoteData_PERSE As String
    Public EmoteData_TARGE As String
    Public EmoteData_PROPE As String
    Public EmoteData_HASTA As String
    Public EmoteData_TARGD As String
    Public EmoteData_PERSD As String
    Public EmoteData_ENDTM As String
    Public EmoteData_TARGR As String
    Public Function PreFilterMessage(ByRef m As Message) As Boolean Implements IMessageFilter.PreFilterMessage
        Dim keyCode As Keys = CType(CInt(m.WParam), Keys) And Keys.KeyCode
        If m.Msg = WM_KEYDOWN And keyCode = Keys.Escape Then
            Me.Close()
            Application.RemoveMessageFilter(Me) : Return True
        End If
        Return False
    End Function 'PreFilterMessage
    Public Function GetFileContents(ByVal FullPath As String, _
           Optional ByRef ErrInfo As String = "") As String

        Dim strContents As String
        Dim objReader As StreamReader
        Try

            objReader = New StreamReader(FullPath)
            strContents = objReader.ReadToEnd()
            Return strContents
            objReader.Close()
            objReader.Dispose()
        Catch Ex As Exception
            Return ""
            ErrInfo = Ex.Message
        End Try
    End Function
    Public Sub LoadScript(ByVal SCRIPTnum As String)
        ScriptData = GetFileContents(Debugger.DirScripts, sErr)
        If sErr = "" Then
            Dim tempvar As Integer = InStr(ScriptData, "SCRIP#" + SCRIPTnum + "(")
            Dim tempvar2 As Integer
            ScriptData_INTRO = ""
            ScriptData_REFRESH = ""
            ScriptData_OPTIONS = ""
            ScriptData_Option(0) = ""
            ScriptData_Option(1) = ""
            ScriptData_Option(2) = ""
            ScriptData_Option(3) = ""
            ScriptData_Option(4) = ""
            If tempvar > 0 Then
                For tempvar2 = InStr(ScriptData, "SCRIP#" + SCRIPTnum + "(") To Len(ScriptData) Step 1
                    If Mid(ScriptData, tempvar2, 1) = ")" Then
                        ScriptData_INTRO = Replace(Mid(ScriptData, tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum))), tempvar2 - (tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum))))), " ", "")
                        Exit For
                    End If
                Next
                tempvar = InStr(ScriptData, "INTRO#" + SCRIPTnum + "(")
                For tempvar2 = InStr(ScriptData, "INTRO#" + SCRIPTnum + "(") To Len(ScriptData) Step 1
                    If Mid(ScriptData, tempvar2, 1) = ")" Then
                        ScriptData_INTRO = Mid(ScriptData, tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum))), +tempvar2 - (tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum)))))
                        Exit For
                    End If
                Next
                tempvar = InStr(ScriptData, "OPTIO#" + SCRIPTnum + "(")
                If tempvar > 0 Then
                    For tempvar2 = InStr(ScriptData, "OPTIO#" + SCRIPTnum + "(") To Len(ScriptData) Step 1
                        If Mid(ScriptData, tempvar2, 1) = ")" Then
                            ScriptData_OPTIONS = Mid(ScriptData, tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum))), tempvar2 - (tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum)))))
                            Exit For
                        End If
                    Next
                End If
                tempvar = InStr(ScriptData, "SUBO1#" + SCRIPTnum + "(")
                If tempvar > 0 Then
                    For tempvar2 = InStr(ScriptData, "SUBO1#" + SCRIPTnum + "(") To Len(ScriptData) Step 1
                        If Mid(ScriptData, tempvar2, 1) = ")" Then
                            ScriptData_Option(0) = Mid(ScriptData, tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum))), tempvar2 - (tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum)))))
                            Exit For
                        End If
                    Next
                End If
                tempvar = InStr(ScriptData, "SUBO2#" + SCRIPTnum + "(")
                If tempvar > 0 Then
                    For tempvar2 = InStr(ScriptData, "SUBO2#" + SCRIPTnum + "(") To Len(ScriptData) Step 1
                        If Mid(ScriptData, tempvar2, 1) = ")" Then
                            ScriptData_Option(1) = Mid(ScriptData, tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum))), tempvar2 - (tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum)))))
                            Exit For
                        End If
                    Next
                End If
                tempvar = InStr(ScriptData, "SUBO3#" + SCRIPTnum + "(")
                If tempvar > 0 Then
                    For tempvar2 = InStr(ScriptData, "SUBO3#" + SCRIPTnum + "(") To Len(ScriptData) Step 1
                        If Mid(ScriptData, tempvar2, 1) = ")" Then
                            ScriptData_Option(2) = Mid(ScriptData, tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum))), tempvar2 - (tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum)))))
                            Exit For
                        End If
                    Next
                End If
                tempvar = InStr(ScriptData, "SUBO4#" + SCRIPTnum + "(")
                If tempvar > 0 Then
                    For tempvar2 = InStr(ScriptData, "SUBO4#" + SCRIPTnum + "(") To Len(ScriptData) Step 1
                        If Mid(ScriptData, tempvar2, 1) = ")" Then
                            ScriptData_Option(3) = Mid(ScriptData, tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum))), tempvar2 - (tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum)))))
                            Exit For
                        End If
                    Next
                End If
                tempvar = InStr(ScriptData, "SUBO5#" + SCRIPTnum + "(")
                If tempvar > 0 Then
                    For tempvar2 = InStr(ScriptData, "SUBO5#" + SCRIPTnum + "(") To Len(ScriptData) Step 1
                        If Mid(ScriptData, tempvar2, 1) = ")" Then
                            ScriptData_Option(4) = Mid(ScriptData, tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum))), tempvar2 - (tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum)))))
                            Exit For
                        End If
                    Next
                End If
                tempvar = InStr(ScriptData, "REFRE#" + SCRIPTnum + "(")
                If tempvar > 0 Then
                    For tempvar2 = InStr(ScriptData, "REFRE#" + SCRIPTnum + "(") To Len(ScriptData) Step 1
                        If Mid(ScriptData, tempvar2, 1) = ")" Then
                            ScriptData_REFRESH = Mid(ScriptData, tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum))), tempvar2 - (tempvar + 7 + Len(LTrim(RTrim(SCRIPTnum)))))
                            Exit For
                        End If
                    Next
                End If
            End If
        Else
            Debug.WriteLine("Error retrieving file: " & sErr)
        End If
    End Sub
    Public Sub LoadMob(ByVal MobVIRID As String)
        Dim npcnum As String = MobVIRID
        Dim mscstr As String = ""
        Dim stepnum As Integer = 0
        Dim tmp0 As Integer
        Dim tmp1 As Integer
        Dim tmp2 As Integer
        Dim tmp3 As Integer
        MobData = GetFileContents(Debugger.DirMobs, sErr)
        tmp0 = InStr(MobData, "SHORT#" + npcnum + "(")
        If tmp0 > 0 Then
            For tmp1 = InStr(MobData, "SHORT#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    MobData_SHORT = Mid(MobData, InStr(MobData, "SHORT#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "SHORT#" + npcnum + "(") - 7 - Len(npcnum))
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "MNAME#" + npcnum + "(")
        If tmp0 > 0 Then
            For tmp1 = InStr(MobData, "MNAME#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    MobData_MNAME = Mid(MobData, InStr(MobData, "MNAME#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "MNAME#" + npcnum + "(") - 7 - Len(npcnum))
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "PARID#" + npcnum + "(")
        If tmp0 > 0 Then : stepnum = 0
            For tmp1 = InStr(MobData, "PARID#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    mscstr = Mid(MobData, InStr(MobData, "PARID#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "PARID#" + npcnum + "(") - 7 - Len(npcnum))
                    For tmp2 = 1 To Len(mscstr) + 1 Step 1
                        If Mid(mscstr + ",", tmp2, 1) = "," Then
                            If stepnum = 0 Then
                                If Val(Mid(mscstr, 1, tmp2 - 1)) = 0 Then
                                    MobData_ARCHE = "Standard"
                                ElseIf Val(Mid(mscstr, 1, tmp2 - 1)) = 1 Then
                                    MobData_ARCHE = "Zombie"
                                ElseIf Val(Mid(mscstr, 1, tmp2 - 1)) = 2 Then
                                    MobData_ARCHE = "Skeletal"
                                ElseIf Val(Mid(mscstr, 1, tmp2 - 1)) = 3 Then
                                    MobData_ARCHE = "Spirit"
                                ElseIf Val(Mid(mscstr, 1, tmp2 - 1)) = 4 Then
                                    MobData_ARCHE = "Phantom"
                                ElseIf Val(Mid(mscstr, 1, tmp2 - 1)) = 5 Then
                                    MobData_ARCHE = "Wraith"
                                ElseIf Val(Mid(mscstr, 1, tmp2 - 1)) = 6 Then
                                    MobData_ARCHE = "Spectral"
                                ElseIf Val(Mid(mscstr, 1, tmp2 - 1)) = 7 Then
                                    MobData_ARCHE = "Horror"
                                ElseIf Val(Mid(mscstr, 1, tmp2 - 1)) = 8 Then
                                    MobData_ARCHE = "Archon"
                                Else
                                    MobData_ARCHE = "Unknown"
                                End If
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 1 Then
                                If Len(Mid(mscstr, tmp3, tmp2 - tmp3)) = 2 Then
                                    MobData_Sentient = "Yes"
                                    If Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 0 Then
                                        MobData_RACET = "Human"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 1 Then
                                        MobData_RACET = "Dwarf"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 2 Then
                                        MobData_RACET = "Gnome"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 3 Then
                                        MobData_RACET = "Elf"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 4 Then
                                        MobData_RACET = "Half-elf"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 5 Then
                                        MobData_RACET = "Halfling"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 6 Then
                                        MobData_RACET = "Gobline"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 7 Then
                                        MobData_RACET = "Troll"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 8 Then
                                        MobData_RACET = "Orc"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 9 Then
                                        MobData_RACET = "Half-orc"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 10 Then
                                        MobData_RACET = "Quickling"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 11 Then
                                        MobData_RACET = "Pixie"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 12 Then
                                        MobData_RACET = "Sprite"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 13 Then
                                        MobData_RACET = "Avarie"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 14 Then
                                        MobData_RACET = "Daemune"
                                    Else
                                        MobData_RACET = "Unknown"
                                    End If
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                Else
                                    MobData_Sentient = "No"
                                    If Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 0 Then
                                        MobData_RACET = "Centaur"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 1 Then
                                        MobData_RACET = "Gryphon"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 2 Then
                                        MobData_RACET = "Troll"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 3 Then
                                        MobData_RACET = "Goblin"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 4 Then
                                        MobData_RACET = "Imp"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 5 Then
                                        MobData_RACET = "Minotaur"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 6 Then
                                        MobData_RACET = "Cyclops"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 7 Then
                                        MobData_RACET = "Hydra"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 8 Then
                                        MobData_RACET = "Faun"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 9 Then
                                        MobData_RACET = "Scorpion"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 10 Then
                                        MobData_RACET = "Unicorn"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 11 Then
                                        MobData_RACET = "Phoenix"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 12 Then
                                        MobData_RACET = "Schilla"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 13 Then
                                        MobData_RACET = "Cerberus"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 14 Then
                                        MobData_RACET = "Balrog"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 15 Then
                                        MobData_RACET = "Bear"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 16 Then
                                        MobData_RACET = "Wolf"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 17 Then
                                        MobData_RACET = "Bat"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 18 Then
                                        MobData_RACET = "Svagin"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 19 Then
                                        MobData_RACET = "Scarab"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 20 Then
                                        MobData_RACET = "Seccubus"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 21 Then
                                        MobData_RACET = "Rat"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 22 Then
                                        MobData_RACET = "Boar"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 23 Then
                                        MobData_RACET = "Ogre"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 24 Then
                                        MobData_RACET = "Golem"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 25 Then
                                        MobData_RACET = "Panther"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 26 Then
                                        MobData_RACET = "Yeti"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 27 Then
                                        MobData_RACET = "Siren"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 28 Then
                                        MobData_RACET = "Krakken"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 29 Then
                                        MobData_RACET = "Drake"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 30 Then
                                        MobData_RACET = "Cobra"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 31 Then
                                        MobData_RACET = "Banshee"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 32 Then
                                        MobData_RACET = "Serpent"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 33 Then
                                        MobData_RACET = "Chimera"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 34 Then
                                        MobData_RACET = "Satyr"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 35 Then
                                        MobData_RACET = "Seccubus"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 36 Then
                                        MobData_RACET = "Pit Viper"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 37 Then
                                        MobData_RACET = "Doppelganger"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 38 Then
                                        MobData_RACET = "Horse"
                                    ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 39 Then
                                        MobData_RACET = "Dog"
                                    Else
                                        MobData_RACET = "Unknown"
                                    End If
                                    tmp3 = tmp2 + 1
                                    stepnum += 1
                                End If
                            ElseIf stepnum = 2 Then
                                If Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 0 Then
                                    MobData_HATE_race = "Human"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 1 Then
                                    MobData_HATE_race = "Dwarf"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 2 Then
                                    MobData_HATE_race = "Gnome"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 3 Then
                                    MobData_HATE_race = "Elf"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 4 Then
                                    MobData_HATE_race = "Half-elf"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 5 Then
                                    MobData_HATE_race = "Halfling"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 6 Then
                                    MobData_HATE_race = "Goblin"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 7 Then
                                    MobData_HATE_race = "Troll"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 8 Then
                                    MobData_HATE_race = "Orc"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 9 Then
                                    MobData_HATE_race = "Half-orc"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 10 Then
                                    MobData_HATE_race = "Quickling"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 11 Then
                                    MobData_HATE_race = "Pixie"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 12 Then
                                    MobData_HATE_race = "Sprite"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 13 Then
                                    MobData_HATE_race = "Avarie"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 14 Then
                                    MobData_HATE_race = "Daemune"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 15 Then
                                    MobData_HATE_race = "None"
                                Else
                                    MobData_HATE_race = "Unknown"
                                End If
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 3 Then
                                If Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 0 Then
                                    MobData_HATE_class = "None"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 1 Then
                                    MobData_HATE_class = "Priest"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 2 Then
                                    MobData_HATE_class = "Deacon"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 3 Then
                                    MobData_HATE_class = "Archdeacon"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 4 Then
                                    MobData_HATE_class = "Bishop"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 5 Then
                                    MobData_HATE_class = "Archbishop"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 6 Then
                                    MobData_HATE_class = "Woodsman"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 7 Then
                                    MobData_HATE_class = "Tracker"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 8 Then
                                    MobData_HATE_class = "Ranger"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 9 Then
                                    MobData_HATE_class = "Druit"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 10 Then
                                    MobData_HATE_class = "Druid"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 11 Then
                                    MobData_HATE_class = "Gravedigger"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 12 Then
                                    MobData_HATE_class = "Ritualist"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 13 Then
                                    MobData_HATE_class = "Warlock"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 14 Then
                                    MobData_HATE_class = "Necromancer"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 15 Then
                                    MobData_HATE_class = "Liche"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 16 Then
                                    MobData_HATE_class = "Mageling"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 17 Then
                                    MobData_HATE_class = "Mage"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 18 Then
                                    MobData_HATE_class = "Wizard"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 19 Then
                                    MobData_HATE_class = "Magus"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 20 Then
                                    MobData_HATE_class = "Supreme Magi"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 21 Then
                                    MobData_HATE_class = "Hermit"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 22 Then
                                    MobData_HATE_class = "Spellbreaker"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 23 Then
                                    MobData_HATE_class = "Soulreaver"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 24 Then
                                    MobData_HATE_class = "Demi-Psion"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 25 Then
                                    MobData_HATE_class = "Psion"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 26 Then
                                    MobData_HATE_class = "Elementalist"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 27 Then
                                    MobData_HATE_class = "Nihilist"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 28 Then
                                    MobData_HATE_class = "Sorceror"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 29 Then
                                    MobData_HATE_class = "Arcanist"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 30 Then
                                    MobData_HATE_class = "Myrmidon"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 31 Then
                                    MobData_HATE_class = "Headhunter"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 32 Then
                                    MobData_HATE_class = "Mercenary"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 33 Then
                                    MobData_HATE_class = "Savant"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 34 Then
                                    MobData_HATE_class = "Sexton"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 35 Then
                                    MobData_HATE_class = "Warlord"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 36 Then
                                    MobData_HATE_class = "Plainsman"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 37 Then
                                    MobData_HATE_class = "Barbarian"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 38 Then
                                    MobData_HATE_class = "Avenger"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 39 Then
                                    MobData_HATE_class = "Warmonger"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 40 Then
                                    MobData_HATE_class = "Beserker"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 41 Then
                                    MobData_HATE_class = "Pickpocket"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 42 Then
                                    MobData_HATE_class = "Rogue"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 43 Then
                                    MobData_HATE_class = "Thief"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 44 Then
                                    MobData_HATE_class = "Assassin"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 45 Then
                                    MobData_HATE_class = "Shadow Walker"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 46 Then
                                    MobData_HATE_class = "Page"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 47 Then
                                    MobData_HATE_class = "Squire"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 48 Then
                                    MobData_HATE_class = "Knight"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 49 Then
                                    MobData_HATE_class = "Centurion"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 50 Then
                                    MobData_HATE_class = "Templar"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 51 Then
                                    MobData_HATE_class = "Scout"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 52 Then
                                    MobData_HATE_class = "Nu-Dosai"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 53 Then
                                    MobData_HATE_class = "Nubo-Medusai"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 54 Then
                                    MobData_HATE_class = "Ado-Mendusai"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 55 Then
                                    MobData_HATE_class = "Saedu-Morusai"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 56 Then
                                    MobData_HATE_class = "Runescribe"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 57 Then
                                    MobData_HATE_class = "Draconian"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 58 Then
                                    MobData_HATE_class = "Paek'oth"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 59 Then
                                    MobData_HATE_class = "Daek'oth"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 60 Then
                                    MobData_HATE_class = "Tzaek'oth"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 61 Then
                                    MobData_HATE_class = "Monk"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 62 Then
                                    MobData_HATE_class = "Dosai"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 63 Then
                                    MobData_HATE_class = "Medusai"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 64 Then
                                    MobData_HATE_class = "Mendusai"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 65 Then
                                    MobData_HATE_class = "Morusai"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 66 Then
                                    MobData_HATE_class = "Minstrel"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 67 Then
                                    MobData_HATE_class = "Bard"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 68 Then
                                    MobData_HATE_class = "Harlequin"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 69 Then
                                    MobData_HATE_class = "Bladesinger"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 70 Then
                                    MobData_HATE_class = "Blademaster"
                                Else
                                    MobData_HATE_class = "Unknown"
                                End If
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 4 Then
                                If Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 0 Then
                                    MobData_HATE_sex = "None"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 1 Then
                                    MobData_HATE_sex = "Males"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 2 Then
                                    MobData_HATE_sex = "Females"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 3 Then
                                    MobData_HATE_sex = "Neutrals"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 4 Then
                                    MobData_HATE_sex = "Males and Females"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 5 Then
                                    MobData_HATE_sex = "Males and Neutrals"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 6 Then
                                    MobData_HATE_sex = "Females and Neutrals"
                                Else
                                    MobData_HATE_sex = "Unknown"
                                End If
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 5 Then
                                If Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 0 Then
                                    MobData_TEMPE = "Passive"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 1 Then
                                    MobData_TEMPE = "Agressive"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 2 Then
                                    MobData_TEMPE = "Coward"
                                Else
                                    MobData_TEMPE = "Unknown"
                                End If
                                MobData_TEMPE = ""
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 6 Then
                                If Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 0 Then
                                    MobData_MobType = "Regular"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 1 Then
                                    MobData_MobType = "Mini-Boss"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 2 Then
                                    MobData_MobType = "Boss"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 3 Then
                                    MobData_MobType = "Rare"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 4 Then
                                    MobData_MobType = "Ultra Rare"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 5 Then
                                    MobData_MobType = "Epic"
                                Else
                                    MobData_MobType = "Unknown"
                                End If
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 7 Then
                                If Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 0 Then
                                    MobData_MobClass = "None"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 1 Then
                                    MobData_MobClass = "Priest"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 2 Then
                                    MobData_MobClass = "Deacon"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 3 Then
                                    MobData_MobClass = "Archdeacon"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 4 Then
                                    MobData_MobClass = "Bishop"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 5 Then
                                    MobData_MobClass = "Archbishop"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 6 Then
                                    MobData_MobClass = "Woodsman"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 7 Then
                                    MobData_MobClass = "Tracker"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 8 Then
                                    MobData_MobClass = "Ranger"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 9 Then
                                    MobData_MobClass = "Druit"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 10 Then
                                    MobData_MobClass = "Druid"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 11 Then
                                    MobData_MobClass = "Gravedigger"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 12 Then
                                    MobData_MobClass = "Ritualist"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 13 Then
                                    MobData_MobClass = "Warlock"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 14 Then
                                    MobData_MobClass = "Necromancer"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 15 Then
                                    MobData_MobClass = "Liche"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 16 Then
                                    MobData_MobClass = "Mageling"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 17 Then
                                    MobData_MobClass = "Mage"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 18 Then
                                    MobData_MobClass = "Wizard"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 19 Then
                                    MobData_MobClass = "Magus"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 20 Then
                                    MobData_MobClass = "Supreme Magi"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 21 Then
                                    MobData_MobClass = "Hermit"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 22 Then
                                    MobData_MobClass = "Spellbreaker"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 23 Then
                                    MobData_MobClass = "Soulreaver"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 24 Then
                                    MobData_MobClass = "Demi-Psion"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 25 Then
                                    MobData_MobClass = "Psion"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 26 Then
                                    MobData_MobClass = "Elementalist"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 27 Then
                                    MobData_MobClass = "Nihilist"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 28 Then
                                    MobData_MobClass = "Sorceror"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 29 Then
                                    MobData_MobClass = "Arcanist"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 30 Then
                                    MobData_MobClass = "Myrmidon"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 31 Then
                                    MobData_MobClass = "Headhunter"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 32 Then
                                    MobData_MobClass = "Mercenary"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 33 Then
                                    MobData_MobClass = "Savant"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 34 Then
                                    MobData_MobClass = "Sexton"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 35 Then
                                    MobData_MobClass = "Warlord"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 36 Then
                                    MobData_MobClass = "Plainsman"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 37 Then
                                    MobData_MobClass = "Barbarian"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 38 Then
                                    MobData_MobClass = "Avenger"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 39 Then
                                    MobData_MobClass = "Warmonger"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 40 Then
                                    MobData_MobClass = "Beserker"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 41 Then
                                    MobData_MobClass = "Pickpocket"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 42 Then
                                    MobData_MobClass = "Rogue"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 43 Then
                                    MobData_MobClass = "Thief"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 44 Then
                                    MobData_MobClass = "Assassin"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 45 Then
                                    MobData_MobClass = "Shadow Walker"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 46 Then
                                    MobData_MobClass = "Page"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 47 Then
                                    MobData_MobClass = "Squire"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 48 Then
                                    MobData_MobClass = "Knight"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 49 Then
                                    MobData_MobClass = "Centurion"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 50 Then
                                    MobData_MobClass = "Templar"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 51 Then
                                    MobData_MobClass = "Scout"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 52 Then
                                    MobData_MobClass = "Nu-Dosai"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 53 Then
                                    MobData_MobClass = "Nubo-Medusai"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 54 Then
                                    MobData_MobClass = "Ado-Mendusai"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 55 Then
                                    MobData_MobClass = "Saedu-Morusai"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 56 Then
                                    MobData_MobClass = "Runescribe"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 57 Then
                                    MobData_MobClass = "Draconian"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 58 Then
                                    MobData_MobClass = "Paek'oth"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 59 Then
                                    MobData_MobClass = "Daek'oth"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 60 Then
                                    MobData_MobClass = "Tzaek'oth"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 61 Then
                                    MobData_MobClass = "Monk"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 62 Then
                                    MobData_MobClass = "Dosai"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 63 Then
                                    MobData_MobClass = "Medusai"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 64 Then
                                    MobData_MobClass = "Mendusai"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 65 Then
                                    MobData_MobClass = "Morusai"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 66 Then
                                    MobData_MobClass = "Minstrel"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 67 Then
                                    MobData_MobClass = "Bard"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 68 Then
                                    MobData_MobClass = "Harlequin"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 69 Then
                                    MobData_MobClass = "Bladesinger"
                                ElseIf Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 70 Then
                                    MobData_MobClass = "Blademaster"
                                Else
                                    MobData_MobClass = "Unknown"
                                End If
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 8 Then
                                If Val(Mid(mscstr, tmp3, tmp2 - tmp3)) = 0 Then
                                    MobData_MobClassCombatPreset = "Unknown"
                                Else
                                    MobData_MobClassCombatPreset = "Unknown"
                                End If
                                tmp3 = tmp2 + 1
                                stepnum += 1
                                Exit For
                            End If
                        End If
                    Next
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "MOBMV#" + npcnum + "(")
        If tmp0 > 0 Then : stepnum = 0
            For tmp1 = InStr(MobData, "MOBMV#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    mscstr = Mid(MobData, InStr(MobData, "MOBMV#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "MOBMV#" + npcnum + "(") - 7 - Len(npcnum))
                    For tmp2 = 1 To Len(mscstr) + 1 Step 1
                        If Mid(mscstr + ",", tmp2, 1) = "," Then
                            If stepnum = 0 Then
                                MobData_PATH_sleep = Mid(mscstr, 1, tmp2 - 1)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 1 Then
                                MobData_PATH_work = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 2 Then
                                MobData_PATH_brekfast = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 3 Then
                                MobData_PATH_lunch = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 4 Then
                                MobData_PATH_dinner = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            End If
                        End If
                    Next
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "MOBTE#" + npcnum + "(")
        If tmp0 > 0 Then : stepnum = 0
            For tmp1 = InStr(MobData, "MOBTE#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    mscstr = Mid(MobData, InStr(MobData, "MOBTE#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "MOBTE#" + npcnum + "(") - 7 - Len(npcnum))
                    For tmp2 = 1 To Len(mscstr) + 1 Step 1
                        If Mid(mscstr + ",", tmp2, 1) = "," Then
                            If stepnum = 0 Then
                                MobData_DROP_static1 = Mid(mscstr, 1, tmp2 - 1)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 1 Then
                                MobData_DROP_static2 = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 2 Then
                                MobData_DROP_static3 = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 3 Then
                                MobData_DROP_static4 = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 4 Then
                                MobData_DROP_static5 = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 5 Then
                                MobData_DROP_dynamic1 = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 6 Then
                                MobData_DROP_dynamic2 = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 7 Then
                                MobData_DROP_dynamic3 = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 8 Then
                                MobData_DROP_dynamic4 = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 9 Then
                                MobData_DROP_dynamic5 = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum = 0
                            End If
                        End If
                    Next
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "LOOKD#" + npcnum + "(")
        If tmp0 > 0 Then
            For tmp1 = InStr(MobData, "LOOKD#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    MobData_LDESC = Mid(MobData, InStr(MobData, "LOOKD#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "LOOKD#" + npcnum + "(") - 7 - Len(npcnum))
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "SCRIT#" + npcnum + "(")
        MobData_HasQuest = False
        If tmp0 > 0 Then
            For tmp1 = InStr(MobData, "SCRIT#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    MobData_SCRIT = Mid(MobData, InStr(MobData, "SCRIT#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "SCRIT#" + npcnum + "(") - 7 - Len(npcnum))
                    For tmp2 = 1 To Len(MobData_SCRIT) Step 1
                        If Mid(MobData_SCRIT, tmp2, 1) = "." Then
                            LoadScript(Mid(MobData_SCRIT, 1, tmp2 - 1))
                            Exit For
                        End If
                    Next
                    If InStr(ScriptData_OPTIONS, "<?Q") Then
                        MobData_HasQuest = True
                    End If
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "DAMTY#" + npcnum + "(")
        If tmp0 > 0 Then : stepnum = 0
            For tmp1 = InStr(MobData, "DAMTY#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    mscstr = Mid(MobData, InStr(MobData, "DAMTY#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "DAMTY#" + npcnum + "(") - 7 - Len(npcnum))
                    For tmp2 = 1 To Len(mscstr) + 1 Step 1
                        If Mid(mscstr + ",", tmp2, 1) = "," Then
                            If stepnum = 2 Then
                                Dim tmp4 As Short
                                Dim tmp5 As Short = 0
                                Dim tmp6 As Short
                                Dim tmpstr As String = Mid(mscstr, 1, tmp2 - 1)
                                For tmp4 = 1 To Len(tmpstr) Step 1
                                    If Mid(tmpstr, tmp4, 1) = "[" Then
                                        MobData_DMG1_name = Mid(tmpstr, 1, tmp4 - 1)
                                        tmp6 = tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "d" Then
                                        MobData_DMG1_dienum = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "]" Then
                                        MobData_DMG1_dietype = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "{" Then
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "," Then
                                        If tmp5 = 0 Then
                                            MobData_DMG1_type = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                            tmp5 += 1
                                        Else
                                            MobData_DMG1_speed = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        End If
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "}" Then
                                        MobData_DMG1_crit = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = +tmp4 + 1
                                        Exit For
                                    End If
                                Next
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 5 Then
                                Dim tmp4 As Short
                                Dim tmp5 As Short = 0
                                Dim tmp6 As Short = tmp3
                                Dim tmpstr As String = Mid(mscstr, 1, tmp2 - 1)
                                For tmp4 = tmp3 To Len(tmpstr) Step 1
                                    If Mid(tmpstr, tmp4, 1) = "[" Then
                                        MobData_DMG2_name = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "d" Then
                                        MobData_DMG2_dienum = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "]" Then
                                        MobData_DMG2_dietype = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "{" Then
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "," Then
                                        If tmp5 = 0 Then
                                            MobData_DMG2_type = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                            tmp5 += 1
                                        Else
                                            MobData_DMG2_speed = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        End If
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "}" Then
                                        MobData_DMG2_crit = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = +tmp4 + 1
                                        Exit For
                                    End If
                                Next
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 8 Then
                                Dim tmp4 As Short
                                Dim tmp5 As Short = 0
                                Dim tmp6 As Short = tmp3
                                Dim tmpstr As String = Mid(mscstr, 1, tmp2 - 1)
                                For tmp4 = tmp3 To Len(tmpstr) Step 1
                                    If Mid(tmpstr, tmp4, 1) = "[" Then
                                        MobData_DMG3_name = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "d" Then
                                        MobData_DMG3_dienum = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "]" Then
                                        MobData_DMG3_dietype = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "{" Then
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "," Then
                                        If tmp5 = 0 Then
                                            MobData_DMG3_type = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                            tmp5 += 1
                                        Else
                                            MobData_DMG3_speed = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        End If
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "}" Then
                                        MobData_DMG3_crit = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = +tmp4 + 1
                                    End If
                                Next
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 11 Then
                                Dim tmp4 As Short
                                Dim tmp5 As Short = 0
                                Dim tmp6 As Short = tmp3
                                Dim tmpstr As String = Mid(mscstr, 1, tmp2 - 1)
                                For tmp4 = tmp3 To Len(tmpstr) Step 1
                                    If Mid(tmpstr, tmp4, 1) = "[" Then
                                        MobData_DMG4_name = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "d" Then
                                        MobData_DMG4_dienum = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "]" Then
                                        MobData_DMG4_dietype = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "{" Then
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "," Then
                                        If tmp5 = 0 Then
                                            MobData_DMG4_type = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                            tmp5 += 1
                                        Else
                                            MobData_DMG4_speed = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        End If
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "}" Then
                                        MobData_DMG4_crit = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = +tmp4 + 1
                                    End If
                                Next
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 14 Then
                                Dim tmp4 As Short
                                Dim tmp5 As Short = 0
                                Dim tmp6 As Short = tmp3
                                Dim tmpstr As String = Mid(mscstr, 1, tmp2 - 1)
                                For tmp4 = tmp3 To Len(tmpstr) Step 1
                                    If Mid(tmpstr, tmp4, 1) = "[" Then
                                        MobData_DMG5_name = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "d" Then
                                        MobData_DMG5_dienum = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "]" Then
                                        MobData_DMG5_dietype = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "{" Then
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "," Then
                                        If tmp5 = 0 Then
                                            MobData_DMG5_type = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                            tmp5 += 1
                                        Else
                                            MobData_DMG5_speed = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                            tmp6 = +tmp4 + 1
                                        End If
                                        tmp6 = +tmp4 + 1
                                    ElseIf Mid(tmpstr, tmp4, 1) = "}" Then
                                        MobData_DMG5_crit = Mid(tmpstr, tmp6, tmp4 - tmp6)
                                        tmp6 = +tmp4 + 1
                                    End If
                                Next
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            Else
                                stepnum += 1
                            End If
                        End If
                    Next
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "ARMOR#" + npcnum + "(")
        If tmp0 > 0 Then : stepnum = 0
            For tmp1 = InStr(MobData, "ARMOR#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    mscstr = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Mid(MobData, InStr(MobData, "ARMOR#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "ARMOR#" + npcnum + "(") - 7 - Len(npcnum)), "BashAC", ""), "SlashAC", ""), "PierceAC", ""), "FistAC", ""), "ExoticAC", ""), "[", ""), "]", "")
                    For tmp2 = 1 To Len(mscstr) + 1 Step 1
                        If Mid(mscstr + ",", tmp2, 1) = "," Then
                            If stepnum = 0 Then
                                MobData_AC_bash = Mid(mscstr, 1, tmp2 - 1)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 1 Then
                                MobData_AC_slash = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 2 Then
                                MobData_AC_pierce = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 3 Then
                                MobData_AC_fist = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 4 Then
                                MobData_AC_exotic = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            End If
                        End If
                    Next
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "ARMST#" + npcnum + "(")
        If tmp0 > 0 Then : stepnum = 0
            For tmp1 = InStr(MobData, "ARMST#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    mscstr = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Mid(MobData, InStr(MobData, "ARMST#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "ARMST#" + npcnum + "(") - 7 - Len(npcnum)), "BashStr", ""), "SlashStr", ""), "PierceStr", ""), "FistStr", ""), "ExoticStr", ""), "[", ""), "]", "")
                    For tmp2 = 1 To Len(mscstr) + 1 Step 1
                        If Mid(mscstr + ",", tmp2, 1) = "," Then
                            If stepnum = 0 Then
                                MobData_STR_bash = Mid(mscstr, 1, tmp2 - 1)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 1 Then
                                MobData_STR_slash = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 2 Then
                                MobData_STR_pierce = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 3 Then
                                MobData_STR_fist = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 4 Then
                                MobData_STR_exotic = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            End If
                        End If
                    Next
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "ELERE#" + npcnum + "(")
        If tmp0 > 0 Then : stepnum = 0
            For tmp1 = InStr(MobData, "ELERE#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    mscstr = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Mid(MobData, InStr(MobData, "ELERE#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "ELERE#" + npcnum + "(") - 7 - Len(npcnum)), "FireRes", ""), "WaterRes", ""), "AirRes", ""), "EarthRes", ""), "SpiritRes", ""), "[", ""), "]", "")
                    For tmp2 = 1 To Len(mscstr) + 1 Step 1
                        If Mid(mscstr + ",", tmp2, 1) = "," Then
                            If stepnum = 0 Then
                                MobData_RES_fire = Mid(mscstr, 1, tmp2 - 1)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 1 Then
                                MobData_RES_water = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 2 Then
                                MobData_RES_air = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 3 Then
                                MobData_RES_earth = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 4 Then
                                MobData_RES_spirit = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            End If
                        End If
                    Next
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "ELEAM#" + npcnum + "(")
        If tmp0 > 0 Then : stepnum = 0
            For tmp1 = InStr(MobData, "ELEAM#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    mscstr = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Mid(MobData, InStr(MobData, "ELEAM#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "ELEAM#" + npcnum + "(") - 7 - Len(npcnum)), "FireAmp", ""), "WaterAmp", ""), "AirAmp", ""), "EarthAmp", ""), "SpiritAmp", ""), "[", ""), "]", "")
                    For tmp2 = 1 To Len(mscstr) + 1 Step 1
                        If Mid(mscstr + ",", tmp2, 1) = "," Then
                            If stepnum = 0 Then
                                MobData_AMP_fire = Mid(mscstr, 1, tmp2 - 1)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 1 Then
                                MobData_AMP_water = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 2 Then
                                MobData_AMP_air = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 3 Then
                                MobData_AMP_earth = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 4 Then
                                MobData_AMP_spirit = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            End If
                        End If
                    Next
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "SELRE#" + npcnum + "(")
        If tmp0 > 0 Then : stepnum = 0
            For tmp1 = InStr(MobData, "SELRE#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    mscstr = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Mid(MobData, InStr(MobData, "SELRE#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "SELRE#" + npcnum + "(") - 7 - Len(npcnum)), "SubFireRes", ""), "SubWaterRes", ""), "SubAirRes", ""), "SubEarthRes", ""), "SubSpiritRes", ""), "[", ""), "]", "")
                    For tmp2 = 1 To Len(mscstr) + 1 Step 1
                        If Mid(mscstr + ",", tmp2, 1) = "," Then
                            If stepnum = 0 Then
                                MobData_RES_subfire = Mid(mscstr, 1, tmp2 - 1)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 1 Then
                                MobData_RES_subwater = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 2 Then
                                MobData_RES_subair = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 3 Then
                                MobData_RES_subearth = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 4 Then
                                MobData_RES_subspirit = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            End If
                        End If
                    Next
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "SELAM#" + npcnum + "(")
        If tmp0 > 0 Then : stepnum = 0
            For tmp1 = InStr(MobData, "SELAM#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    mscstr = Replace(Replace(Replace(Replace(Replace(Replace(Replace(Mid(MobData, InStr(MobData, "SELAM#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "SELAM#" + npcnum + "(") - 7 - Len(npcnum)), "SubFireAmp", ""), "SubWaterAmp", ""), "SubAirAmp", ""), "SubEarthAmp", ""), "SubSpiritAmp", ""), "[", ""), "]", "")
                    For tmp2 = 1 To Len(mscstr) + 1 Step 1
                        If Mid(mscstr + ",", tmp2, 1) = "," Then
                            If stepnum = 0 Then
                                MobData_AMP_subfire = Mid(mscstr, 1, tmp2 - 1)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 1 Then
                                MobData_AMP_subwater = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 2 Then
                                MobData_AMP_subair = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 3 Then
                                MobData_AMP_subearth = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 4 Then
                                MobData_AMP_subspirit = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            End If
                        End If
                    Next
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "MOUNT#" + npcnum + "(")
        If tmp0 > 0 Then : stepnum = 0
            For tmp1 = InStr(MobData, "MOUNT#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    mscstr = Mid(MobData, InStr(MobData, "MOUNT#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "MOUNT#" + npcnum + "(") - 7 - Len(npcnum))
                    For tmp2 = 1 To Len(mscstr) + 1 Step 1
                        If Mid(mscstr + ",", tmp2, 1) = "," Then
                            If stepnum = 0 Then
                                MobData_MOUNT_bag = Mid(mscstr, 1, tmp2 - 1)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 1 Then
                                MobData_MOUNT_speed = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 2 Then
                                MobData_MOUNT_lvlreq = Mid(mscstr, tmp3, tmp2 - tmp3)
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            ElseIf stepnum = 3 Then
                                Dim tmp4 As Short
                                Dim tmp5 As Short
                                Dim tmpstr2 As String = Mid(mscstr, tmp3, tmp2 - 3)
                                For tmp4 = 1 To Len(tmpstr2) Step 1
                                    If Mid(tmpstr2, tmp4, 1) = "S" Then
                                        MobData_MOUNT_soverncost = Mid(tmpstr2, 1, tmp4 - 1)
                                        tmp5 = tmp4 + 2
                                    ElseIf Mid(tmpstr2, tmp4, 1) = "D" Then
                                        MobData_MOUNT_dovercost = Mid(tmpstr2, tmp5, tmp4 - tmp5)
                                        tmp5 = tmp4 + 2
                                    ElseIf Mid(tmpstr2, tmp4, 1) = "V" Then
                                        MobData_MOUNT_verncost = Mid(tmpstr2, tmp5, tmp4 - tmp5)
                                        Exit For
                                    End If
                                Next
                                tmp3 = tmp2 + 1
                                stepnum += 1
                            End If
                        End If
                    Next
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "HITPO#" + npcnum + "(")
        If tmp0 > 0 Then
            For tmp1 = InStr(MobData, "HITPO#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    MobData_HITPO = Mid(MobData, InStr(MobData, "HITPO#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "HITPO#" + npcnum + "(") - 7 - Len(npcnum))
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "WILLP#" + npcnum + "(")
        If tmp0 > 0 Then
            For tmp1 = InStr(MobData, "WILLP#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    MobData_WILLP = Mid(MobData, InStr(MobData, "WILLP#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "WILLP#" + npcnum + "(") - 7 - Len(npcnum))
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "STAMP#" + npcnum + "(")
        If tmp0 > 0 Then
            For tmp1 = InStr(MobData, "STAMP#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    MobData_STAMP = Mid(MobData, InStr(MobData, "STAMP#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "STAMP#" + npcnum + "(") - 7 - Len(npcnum))
                    Exit For
                End If
            Next
        End If
        tmp0 = InStr(MobData, "LEVEL#" + npcnum + "(")
        If tmp0 > 0 Then
            For tmp1 = InStr(MobData, "LEVEL#" + npcnum + "(") To Len(MobData) Step 1
                If Mid(MobData, tmp1, 1) = ")" Then
                    MobData_LEVEL = Mid(MobData, InStr(MobData, "LEVEL#" + npcnum + "(") + 7 + Len(npcnum), tmp1 - InStr(MobData, "LEVEL#" + npcnum + "(") - 7 - Len(npcnum))
                    Exit For
                End If
            Next
        End If
    End Sub
    Public Function SaveTextToFile(ByVal strData As String, _
     ByVal FullPath As String, _
       Optional ByVal ErrInfo As String = "") As Boolean

        Dim bAns As Boolean = False
        Dim objReader As StreamWriter
        Try
            objReader = New StreamWriter(FullPath)
            objReader.Write(strData)
            objReader.Close()
            objReader.Dispose()
            bAns = True
        Catch Ex As Exception
            ErrInfo = Ex.Message
        End Try
        Return bAns
    End Function
    Dim serr As String
    Dim bans As Boolean
    Private Sub FindMobiles(ByVal sender As System.Object, ByVal e As System.EventArgs)
        CurSectorNPCLIST.Items.Clear()
        Dim int2 As Integer
        Dim int3 As Integer
        Dim CurNum As Integer = 1
        Dim str1 As String = Replace(Str(CurNum), " ", "")
        MobData = GetFileContents(Debugger.DirMobs, serr)
        int2 = InStr(MobData, "SHORT#" + str1 + "(")
        While int2 > 0
            For int3 = int2 To Len(MobData) Step 1
                If Mid(MobData, int3, 1) = ")" Then
                    CurSectorNPCLIST.Items.Add(Mid(MobData, int2 + 7 + Len(str1), int3 - int2 - 7 - Len(str1)))
                    CurNum += 1
                    str1 = Replace(Str(CurNum), " ", "")
                    Exit For
                End If
            Next
            int2 = InStr(MobData, "SHORT#" + str1 + "(")
        End While
        If CurSectorNPCLIST.Items.Count > 0 Then CurSectorNPCLIST.Text = CurSectorNPCLIST.Items(9)
    End Sub

    Private Sub emotechange(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CheckBox1.CheckedChanged
        If CheckBox1.Checked = True Then
            TextBox1.Enabled = True
        Else
            TextBox1.Enabled = False
        End If
    End Sub

    Private Sub InsertMobile(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        If TextBox1.Enabled = False Then
            If MapEditor.MapMobiles(MapEditor.CurX, MapEditor.CurY) <> "" Then MapEditor.MapMobiles(MapEditor.CurX, MapEditor.CurY) += "," + Replace(Str(CurSectorNPCLIST.SelectedIndex + 1), " ", "") + "." + CurSectorNPCEmoteLIST.Text Else MapEditor.MapMobiles(MapEditor.CurX, MapEditor.CurY) = Replace(Str(CurSectorNPCLIST.SelectedIndex + 1), " ", "") + "." + CurSectorNPCEmoteLIST.Text
        Else
            If MapEditor.MapMobiles(MapEditor.CurX, MapEditor.CurY) <> "" Then MapEditor.MapMobiles(MapEditor.CurX, MapEditor.CurY) += "," + Replace(Str(CurSectorNPCLIST.SelectedIndex + 1), " ", "") + "." + CurSectorNPCEmoteLIST.Text + "[" + TextBox1.Text + "]" Else MapEditor.MapMobiles(MapEditor.CurX, MapEditor.CurY) = Replace(Str(CurSectorNPCLIST.SelectedIndex + 1), " ", "") + "." + CurSectorNPCEmoteLIST.Text + "[" + TextBox1.Text + "]"
        End If
        LoadMob(LTrim(Str(CurSectorNPCLIST.SelectedIndex + 1)))
        If TextBox1.Enabled = False Then
            MapEditor.Mobilelist.Items.Add(LTrim(Str(CurSectorNPCLIST.SelectedIndex + 1)) + ". " + MobData_SHORT + "<" + MobData_MNAME + ">{" + CurSectorNPCEmoteLIST.Text + "}")
        Else
            MapEditor.Mobilelist.Items.Add(LTrim(Str(CurSectorNPCLIST.SelectedIndex + 1)) + ". " + MobData_SHORT + "<" + MobData_MNAME + ">{" + CurSectorNPCEmoteLIST.Text + "[" + TextBox1.Text + "]}")
        End If
        DefaultMobile = CurSectorNPCLIST.SelectedIndex
        Me.Close()
    End Sub

    Private Sub CloseAddMobile(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        Me.Close()
    End Sub

    Private Sub LoadEmotes(ByVal sender As System.Object, ByVal e As System.EventArgs)
        CurSectorNPCEmoteLIST.Items.Clear()
        Dim int2 As Integer
        Dim int3 As Integer
        Dim CurNum As Integer = 1
        Dim str1 As String = Replace(Str(CurNum), " ", "")
        EmoteData = GetFileContents(Debugger.DirEmotes, serr)
        int2 = InStr(EmoteData, "EMOTE#" + str1 + "(")
        While int2 > 0
            For int3 = int2 To Len(EmoteData) Step 1
                If Mid(EmoteData, int3, 1) = ")" Then
                    CurSectorNPCEmoteLIST.Items.Add(Mid(EmoteData, int2 + 7 + Len(str1), int3 - int2 - 7 - Len(str1)))
                    CurNum += 1
                    str1 = Replace(Str(CurNum), " ", "")
                    Exit For
                End If
            Next
            int2 = InStr(EmoteData, "EMOTE#" + str1 + "(")
        End While
        If CurSectorNPCEmoteLIST.Items.Count > 0 Then CurSectorNPCEmoteLIST.Text = CurSectorNPCEmoteLIST.Items(5)
    End Sub

    Private Sub MapEditorAddMobileLOad(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
        Application.AddMessageFilter(Me)
        LoadEmotes(0, System.EventArgs.Empty)
        FindMobiles(0, System.EventArgs.Empty)
        If DefaultMobile <> 0 Then
            CurSectorNPCLIST.SelectedIndex = DefaultMobile
        End If
    End Sub
    Public Sub ShowEmote(ByVal Emote As String, ByVal User As String, ByVal target As Short)
        EmoteData = GetFileContents(Debugger.DirEmotes, sErr)
        If sErr = "" Then
            Dim tempvar As Integer = InStr(EmoteData, "EMOTE#")
            Dim tempvar2 As Integer
            Dim EmoteVIRID As String = "3"
            If tempvar > 0 Then
                tempvar = InStr(EmoteData, "(" + Emote + ")")
                For tempvar2 = InStr(EmoteData, "(" + Emote + ")") To Len(EmoteData) Step 1
                    If Mid(EmoteData, tempvar2, 1) = "#" Then
                        Dim aint As Integer
                        For aint = tempvar2 To Len(EmoteData) Step 1
                            If Mid(EmoteData, aint, 1) = "(" Then
                                EmoteVIRID = Mid(EmoteData, tempvar2 + 1, aint - tempvar2 - 1)
                                Exit For
                            End If
                        Next
                        Exit For
                    End If
                Next
                tempvar = InStr(EmoteData, "EMOTE#" + EmoteVIRID + "(")
                For tempvar2 = InStr(EmoteData, "EMOTE#" + EmoteVIRID + "(") To Len(EmoteData) Step 1
                    If Mid(EmoteData, tempvar2, 1) = ")" Then
                        EmoteData_EMOTE = Mid(EmoteData, InStr(EmoteData, "EMOTE#" + EmoteVIRID + "(") + 7 + Len(EmoteVIRID), tempvar2 - (tempvar + 7 + Len(EmoteVIRID)))
                        Exit For
                    End If
                Next
                tempvar = InStr(EmoteData, "PERSE#" + EmoteVIRID + "(")
                For tempvar2 = InStr(EmoteData, "PERSE#" + EmoteVIRID + "(") To Len(EmoteData) Step 1
                    If Mid(EmoteData, tempvar2, 1) = ")" Then
                        EmoteData_PERSE = Mid(EmoteData, InStr(EmoteData, "PERSE#" + EmoteVIRID + "(") + 7 + Len(EmoteVIRID), tempvar2 - (tempvar + 7 + Len(EmoteVIRID)))
                        Exit For
                    End If
                Next
                tempvar = InStr(EmoteData, "TARGE#" + EmoteVIRID + "(")
                For tempvar2 = InStr(EmoteData, "TARGE#" + EmoteVIRID + "(") To Len(EmoteData) Step 1
                    If Mid(EmoteData, tempvar2, 1) = ")" Then
                        EmoteData_TARGE = Mid(EmoteData, InStr(EmoteData, "TARGE#" + EmoteVIRID + "(") + 7 + Len(EmoteVIRID), tempvar2 - (tempvar + 7 + Len(EmoteVIRID)))
                        Exit For
                    End If
                Next
                tempvar = InStr(EmoteData, "PROPE#" + EmoteVIRID + "(")
                For tempvar2 = InStr(EmoteData, "PROPE#" + EmoteVIRID + "(") To Len(EmoteData) Step 1
                    If Mid(EmoteData, tempvar2, 1) = ")" Then
                        EmoteData_PROPE = Mid(EmoteData, InStr(EmoteData, "PROPE#" + EmoteVIRID + "(") + 7 + Len(EmoteVIRID), tempvar2 - (tempvar + 7 + Len(EmoteVIRID)))
                        Exit For
                    End If
                Next
                tempvar = InStr(EmoteData, "HASTA#" + EmoteVIRID + "(")
                For tempvar2 = InStr(EmoteData, "HASTA#" + EmoteVIRID + "(") To Len(EmoteData) Step 1
                    If Mid(EmoteData, tempvar2, 1) = ")" Then
                        EmoteData_HASTA = Mid(EmoteData, InStr(EmoteData, "HASTA#" + EmoteVIRID + "(") + 7 + Len(EmoteVIRID), tempvar2 - (tempvar + 7 + Len(EmoteVIRID)))
                        Exit For
                    End If
                Next
                If EmoteData_HASTA = 1 Then
                    tempvar = InStr(EmoteData, "TARGD#" + EmoteVIRID + "(")
                    For tempvar2 = InStr(EmoteData, "TARGD#" + EmoteVIRID + "(") To Len(EmoteData) Step 1
                        If Mid(EmoteData, tempvar2, 1) = ")" Then
                            EmoteData_TARGD = Mid(EmoteData, InStr(EmoteData, "TARGD#" + EmoteVIRID + "(") + 7 + Len(EmoteVIRID), tempvar2 - (tempvar + 7 + Len(EmoteVIRID)))
                            Exit For
                        End If
                    Next
                    tempvar = InStr(EmoteData, "PERSD#" + EmoteVIRID + "(")
                    For tempvar2 = InStr(EmoteData, "PERSD#" + EmoteVIRID + "(") To Len(EmoteData) Step 1
                        If Mid(EmoteData, tempvar2, 1) = ")" Then
                            EmoteData_PERSD = Mid(EmoteData, InStr(EmoteData, "PERSD#" + EmoteVIRID + "(") + 7 + Len(EmoteVIRID), tempvar2 - (tempvar + 7 + Len(EmoteVIRID)))
                            Exit For
                        End If
                    Next
                    tempvar = InStr(EmoteData, "TARGR#" + EmoteVIRID + "(")
                    For tempvar2 = InStr(EmoteData, "TARGR#" + EmoteVIRID + "(") To Len(EmoteData) Step 1
                        If Mid(EmoteData, tempvar2, 1) = ")" Then
                            EmoteData_TARGR = Mid(EmoteData, InStr(EmoteData, "TARGR#" + EmoteVIRID + "(") + 7 + Len(EmoteVIRID), tempvar2 - (tempvar + 7 + Len(EmoteVIRID)))
                            Exit For
                        End If
                    Next
                End If
                tempvar = InStr(EmoteData, "ENDTM#" + EmoteVIRID + "(")
                For tempvar2 = InStr(EmoteData, "ENDTM#" + EmoteVIRID + "(") To Len(EmoteData) Step 1
                    If Mid(EmoteData, tempvar2, 1) = ")" Then
                        EmoteData_ENDTM = Mid(EmoteData, InStr(EmoteData, "ENDTM#" + EmoteVIRID + "(") + 7 + Len(EmoteVIRID), tempvar2 - (tempvar + 7 + Len(EmoteVIRID)))
                        Exit For
                    End If
                Next
            End If
        Else
            Debug.WriteLine("Error retrieving file: " & sErr)
        End If
    End Sub
End Class